<template>
    <div>
        <lineChart :xData="xData" :yData="yData" title="首页折线图"></lineChart>
    </div>
</template>

<script>
import lineChart from '@/components/line/LineChart.vue';
import { homeTotaldataReq } from '@/api/home.api'
export default {
    components: {
        lineChart
    },
    data() {
        return {
            xData: [],
            yData: []
        }
    },
    created() {
        homeTotaldataReq().then(res => {
            this.xData = res.data.xData
            this.yData = [
                {
                    name: '订单量',
                    data: res.data.orderData
                },
                {
                    name: '销售额',
                    data: res.data.amountData
                }
            ]
        })
    }

}
</script>

<style lang="less" scoped>
div {
    width: 100%;
    height: 100%;
}
</style>